package cn.duxiaod.demo.Arrays.asList;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ArraysAsListTests {

    public static void main(String[] args) {
        /**
         * 实际底层实现为数组
         * 不支持add和remove等操作，内部类底层方法未实现
         */
        Integer[] array = {1,2,4};

        List ints = Arrays.asList(array);
        System.out.println(ints.get(0));
        System.out.println(ints.get(1));

        ints = new ArrayList(ints);
        ints.add(1);
        ints.forEach(System.out::println);
    }
}
